<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requeste|
d.
*/
//前台主页
Route::get('/', function () {
	//查询类型数据库
    $list = DB::table('type')->get();
    
    //带参显示前台主页
	return view('home.index', ['list'=>$list]);
});

//退出登录
Route::get('/over','home\LoginController@over');




//前台路由群组
Route::group(['prefix' => 'home','middleware' => 'home'], function () {
////个人中心
Route::get('/person', 'home\personController@index');
//个人信息
Route::get('/information', 'home\personController@information');
});









//Route::('/login', 'home\LoginController@login')
//登录、注册
Route::post('/login', 'home\LoginController@login');
Route::get('/login', 'home\LoginController@index');
//显示注册页面
Route::get('/register', 'home\RegisterController@index');
//注册方法
Route::post('/register', 'home\RegisterController@doRegister');

//================================================================================================================

Route::group(['prefix' => 'admin', 'middleware' => 'login'], function () {
	//显示后台页面
	Route::get('/demo', 'admin\AdminController@index');
	//清除session
	Route::get('/over', 'admin\LoginController@over');
	Route::get('demo', 'admin\adminController@index');
	Route::resource('/user', 'admin\user\userController');
	//mzm
	Route::resource('/demo/type', 'admin\type\TypeController');
     Route::get('/demo/typeSon/{id}', 'admin\type\TypeController@createSon');
    Route::post('/demo/typeSon', 'admin\type\TypeController@storeSon');
	
	   //删除商品
    Route::get('/shopsDele/{id}', 'admin\user\userController@shopsDele');
        //头条新闻
    Route::resource('/news', 'admin\news\newsController');

     //创建资源路由 商品管理
    Route::resource('/goods', 'admin\goods\GoodsController');
    //商品加精路由
    Route::post('/goodsHot/{id}', 'admin\goods\GoodsController@doHot');
    //商品未审核路由
    Route::get('/goodsAuditing', 'admin\goods\GoodsController@indexAuditing');
    //审核商品路由
    Route::post('/goodsAuditing/{id}', 'admin\goods\GoodsController@doAuditing');
    //拒绝审核路由
    Route::post('/destroyAuditing/{id}', 'admin\goods\GoodsController@destroyAuditing');
    //商品详情路由
    Route::get('/indexShop/{id}', 'admin\goods\GoodsController@indexShop');

});
//显示后台登录页面
Route::get('admin/login', 'admin\LoginController@index');
//后台登录
Route::post('admin/login', 'admin\LoginController@doLogin');
//验证码
Route::get('admin/capth/{tmp}', 'admin\LoginController@capth');


//Route::get('admin/demo', 'admin\AdminController@index');
//
